qt-chat-app

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

U1766664436__alter_table_message.sql (602B)


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