qt-chat-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

U1766663201__alter_table_message.sql (576B)


      1 PRAGMA foreign_keys = OFF;
      2 
      3 CREATE TABLE "__alter_table_message" (
      4     'id' INTEGER PRIMARY KEY NOT NULL,
      5     'chat_id' INTEGER NOT NULL REFERENCES 'chat'('id'),
      6     'content' TEXT NOT NULL,
      7     'sender_id' INTEGER NOT NULL REFERENCES 'profile'('id')
      8 ) STRICT;
      9 
     10 INSERT INTO
     11     "__alter_table_message" ("content", "id", "chat_id")
     12 SELECT
     13     "content",
     14     "id",
     15     "chat_id"
     16 FROM
     17     "message";
     18 
     19 DROP TABLE "message";
     20 
     21 PRAGMA legacy_alter_table = ON;
     22 
     23 ALTER TABLE
     24     "__alter_table_message" RENAME TO "message";
     25 
     26 PRAGMA legacy_alter_table = OFF;
     27 
     28 PRAGMA foreign_keys = ON;