qt-chat-app

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

U1766664610__alter_table_message.sql (631B)


      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 REFERENCES 'profile'('id') NULL,
      8     'sent_at' TEXT NOT NULL
      9 ) STRICT;
     10 
     11 INSERT INTO
     12     "__alter_table_message" ("sender_id", "chat_id", "id", "content")
     13 SELECT
     14     "sender_id",
     15     "chat_id",
     16     "id",
     17     "content"
     18 FROM
     19     "message";
     20 
     21 DROP TABLE "message";
     22 
     23 PRAGMA legacy_alter_table = ON;
     24 
     25 ALTER TABLE
     26     "__alter_table_message" RENAME TO "message";
     27 
     28 PRAGMA legacy_alter_table = OFF;
     29 
     30 PRAGMA foreign_keys = ON;