diff --git a/.vscode/launch.json b/.vscode/launch.json index 718f58d4..685b811e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,7 +52,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 7a6eddc0..f9b9dfb7 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -337,7 +337,7 @@ $BODY$; //Add user options table await ExecQueryAsync("CREATE TABLE auseroptions (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + - "userid bigint not null, translationid bigint not null REFERENCES atranslation (id), languageoverride text, timezoneoverride text, " + + "userid bigint not null REFERENCES auser (id), translationid bigint not null REFERENCES atranslation (id), languageoverride text, timezoneoverride text, " + "currencyname text, hour12 bool not null, emailaddress text, uicolor varchar(12) not null default '#000000')"); @@ -685,22 +685,22 @@ $BODY$; LogUpdateMessage(log); await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + - "userid bigint not null, ayatype integer not null, eventtype integer not null, advancenotice interval not null, " + + "userid bigint not null REFERENCES auser (id), ayatype integer not null, eventtype integer not null, advancenotice interval not null, " + "idvalue bigint not null, decvalue decimal(19,4) not null, agevalue interval not null, deliverymethod integer not null, " + "deliveryaddress text, linkreportid bigint not null, tags varchar(255) ARRAY)"); await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " + "ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " + - "userid bigint not null, idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp not null, message text)"); + "userid bigint not null REFERENCES auser (id), idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp not null, message text)"); - await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, " + + await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null REFERENCES auser (id), " + "created timestamp not null, ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, " + "notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, message text, fetched bool not null)"); await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed timestamp not null, " + "ayatype integer not null, objectid bigint not null, eventtype integer not null, notifysubscriptionid bigint not null, idvalue bigint not null, " + - "decvalue decimal(19,4) not null, userid bigint not null, deliverymethod integer not null, fail bool not null, error text)"); + "decvalue decimal(19,4) not null, userid bigint not null REFERENCES auser (id), deliverymethod integer not null, fail bool not null, error text)"); await SetSchemaLevelAsync(++currentSchema); }