BEGIN TRANSACTION;

ALTER TABLE user ADD COLUMN "is_live" INTEGER NOT NULL DEFAULT 1;

ALTER TABLE user RENAME TO old_user;

CREATE TABLE "user" (
	"id"	INTEGER NOT NULL UNIQUE,
	"name"	TEXT NOT NULL UNIQUE,
	"reference"	TEXT NOT NULL UNIQUE,
	"motto"	TEXT NOT NULL DEFAULT "",
	"password_hash"	TEXT NOT NULL,
	"is_admin" INTEGER NOT NULL DEFAULT 0,
	"is_live" INTEGER NOT NULL DEFAULT 1,
	PRIMARY KEY("id" AUTOINCREMENT)
);

INSERT INTO user SELECT * FROM old_user;

DROP TABLE "old_user";

COMMIT;
