
This revamps the whole access control system to use a separate ACL instead of relying on the "owner" field of the survey, allowing more granular definitions of access to surveys (cloning, editing, viewing results etc.) Closes #17
475 lines
No EOL
12 KiB
JSON
475 lines
No EOL
12 KiB
JSON
{
|
|
"version": "5",
|
|
"dialect": "mysql",
|
|
"id": "4d29fb1a-427c-4082-a176-08688a6d9f2e",
|
|
"prevId": "43f0adbb-ed0a-4d90-bb8a-1629fa070717",
|
|
"tables": {
|
|
"sessions": {
|
|
"name": "sessions",
|
|
"columns": {
|
|
"token": {
|
|
"name": "token",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"userId": {
|
|
"name": "userId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"expires": {
|
|
"name": "expires",
|
|
"type": "bigint",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"sessions_userId_users_table_id_fk": {
|
|
"name": "sessions_userId_users_table_id_fk",
|
|
"tableFrom": "sessions",
|
|
"tableTo": "users_table",
|
|
"columnsFrom": [
|
|
"userId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"sessions_token": {
|
|
"name": "sessions_token",
|
|
"columns": [
|
|
"token"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"survey_access_table": {
|
|
"name": "survey_access_table",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"surveyId": {
|
|
"name": "surveyId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"recepientEmail": {
|
|
"name": "recepientEmail",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"accessToken": {
|
|
"name": "accessToken",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"token_index": {
|
|
"name": "token_index",
|
|
"columns": [
|
|
"accessToken"
|
|
],
|
|
"isUnique": false
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"survey_access_table_surveyId_surveys_table_id_fk": {
|
|
"name": "survey_access_table_surveyId_surveys_table_id_fk",
|
|
"tableFrom": "survey_access_table",
|
|
"tableTo": "surveys_table",
|
|
"columnsFrom": [
|
|
"surveyId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"survey_access_table_id": {
|
|
"name": "survey_access_table_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"survey_answers_table": {
|
|
"name": "survey_answers_table",
|
|
"columns": {
|
|
"participantId": {
|
|
"name": "participantId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"skillId": {
|
|
"name": "skillId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"rating": {
|
|
"name": "rating",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"survey_answers_table_participantId_survey_access_table_id_fk": {
|
|
"name": "survey_answers_table_participantId_survey_access_table_id_fk",
|
|
"tableFrom": "survey_answers_table",
|
|
"tableTo": "survey_access_table",
|
|
"columnsFrom": [
|
|
"participantId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"survey_answers_table_skillId_survey_skills_table_id_fk": {
|
|
"name": "survey_answers_table_skillId_survey_skills_table_id_fk",
|
|
"tableFrom": "survey_answers_table",
|
|
"tableTo": "survey_skills_table",
|
|
"columnsFrom": [
|
|
"skillId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"survey_answers_table_participantId_skillId_pk": {
|
|
"name": "survey_answers_table_participantId_skillId_pk",
|
|
"columns": [
|
|
"participantId",
|
|
"skillId"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"survey_permissions_table": {
|
|
"name": "survey_permissions_table",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"surveyId": {
|
|
"name": "surveyId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"access": {
|
|
"name": "access",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"user_index": {
|
|
"name": "user_index",
|
|
"columns": [
|
|
"user"
|
|
],
|
|
"isUnique": false
|
|
},
|
|
"survey_index": {
|
|
"name": "survey_index",
|
|
"columns": [
|
|
"surveyId"
|
|
],
|
|
"isUnique": false
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"survey_permissions_table_surveyId_surveys_table_id_fk": {
|
|
"name": "survey_permissions_table_surveyId_surveys_table_id_fk",
|
|
"tableFrom": "survey_permissions_table",
|
|
"tableTo": "surveys_table",
|
|
"columnsFrom": [
|
|
"surveyId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"survey_permissions_table_user_users_table_id_fk": {
|
|
"name": "survey_permissions_table_user_users_table_id_fk",
|
|
"tableFrom": "survey_permissions_table",
|
|
"tableTo": "users_table",
|
|
"columnsFrom": [
|
|
"user"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"survey_permissions_table_id": {
|
|
"name": "survey_permissions_table_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {
|
|
"survey_user_un": {
|
|
"name": "survey_user_un",
|
|
"columns": [
|
|
"surveyId",
|
|
"user"
|
|
]
|
|
}
|
|
},
|
|
"checkConstraint": {}
|
|
},
|
|
"survey_skills_table": {
|
|
"name": "survey_skills_table",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"surveyId": {
|
|
"name": "surveyId",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"title": {
|
|
"name": "title",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"survey_skills_table_surveyId_surveys_table_id_fk": {
|
|
"name": "survey_skills_table_surveyId_surveys_table_id_fk",
|
|
"tableFrom": "survey_skills_table",
|
|
"tableTo": "surveys_table",
|
|
"columnsFrom": [
|
|
"surveyId"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"survey_skills_table_id": {
|
|
"name": "survey_skills_table_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"surveys_table": {
|
|
"name": "surveys_table",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"title": {
|
|
"name": "title",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"owner": {
|
|
"name": "owner",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"surveys_table_owner_users_table_id_fk": {
|
|
"name": "surveys_table_owner_users_table_id_fk",
|
|
"tableFrom": "surveys_table",
|
|
"tableTo": "users_table",
|
|
"columnsFrom": [
|
|
"owner"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"surveys_table_id": {
|
|
"name": "surveys_table_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"users_table": {
|
|
"name": "users_table",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"password_hash": {
|
|
"name": "password_hash",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"verification_code": {
|
|
"name": "verification_code",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"verifcationCodeExpires": {
|
|
"name": "verifcationCodeExpires",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"users_table_id": {
|
|
"name": "users_table_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {
|
|
"users_table_email_unique": {
|
|
"name": "users_table_email_unique",
|
|
"columns": [
|
|
"email"
|
|
]
|
|
}
|
|
},
|
|
"checkConstraint": {}
|
|
}
|
|
},
|
|
"views": {},
|
|
"_meta": {
|
|
"schemas": {},
|
|
"tables": {},
|
|
"columns": {}
|
|
},
|
|
"internal": {
|
|
"tables": {},
|
|
"indexes": {}
|
|
}
|
|
} |