15 changed files with 502 additions and 52 deletions
-
104Cargo.lock
-
137README.md
-
1cli/Cargo.toml
-
5cli/README.md
-
37cli/src/main.rs
-
1core/Cargo.toml
-
35core/migrations/2020-09-09-165759_membership_enabled/down.sql
-
5core/migrations/2020-09-09-165759_membership_enabled/up.sql
-
138core/src/db.rs
-
1core/src/lib.rs
-
67core/src/models.rs
-
20core/src/post.rs
-
1core/src/schema.rs
-
1core/src/schema.sql
-
1core/src/schema.sql.m4
@ -0,0 +1,5 @@ |
|||
# mailpot-cli |
|||
|
|||
```shell |
|||
cargo run --bin mpot -- help |
|||
``` |
@ -0,0 +1,35 @@ |
|||
-- This file should undo anything in `up.sql` |
|||
|
|||
BEGIN TRANSACTION; |
|||
PRAGMA foreign_keys = false; |
|||
CREATE TEMPORARY TABLE membership_backup( |
|||
list INTEGER NOT NULL, |
|||
address TEXT NOT NULL, |
|||
name TEXT, |
|||
enabled BOOLEAN CHECK (enabled in (0, 1)) NOT NULL DEFAULT 1, |
|||
digest BOOLEAN CHECK (digest in (0, 1)) NOT NULL DEFAULT 0, |
|||
hide_address BOOLEAN CHECK (hide_address in (0, 1)) NOT NULL DEFAULT 0, |
|||
receive_duplicates BOOLEAN CHECK (receive_duplicates in (0, 1)) NOT NULL DEFAULT 1, |
|||
receive_own_posts BOOLEAN CHECK (receive_own_posts in (0, 1)) NOT NULL DEFAULT 0, |
|||
receive_confirmation BOOLEAN CHECK (receive_confirmation in (0, 1)) NOT NULL DEFAULT 1, |
|||
PRIMARY KEY (list, address), |
|||
FOREIGN KEY (list) REFERENCES mailing_lists(pk) ON DELETE CASCADE |
|||
); |
|||
INSERT INTO membership_backup SELECT list,address,name,enabled,digest,hide_address,receive_own_posts,receive_duplicates,receive_confirmation FROM membership; |
|||
DROP TABLE membership; |
|||
CREATE TABLE membership( |
|||
list INTEGER NOT NULL, |
|||
address TEXT NOT NULL, |
|||
name TEXT, |
|||
digest BOOLEAN CHECK (digest in (0, 1)) NOT NULL DEFAULT 0, |
|||
hide_address BOOLEAN CHECK (hide_address in (0, 1)) NOT NULL DEFAULT 0, |
|||
receive_duplicates BOOLEAN CHECK (receive_duplicates in (0, 1)) NOT NULL DEFAULT 1, |
|||
receive_own_posts BOOLEAN CHECK (receive_own_posts in (0, 1)) NOT NULL DEFAULT 0, |
|||
receive_confirmation BOOLEAN CHECK (receive_confirmation in (0, 1)) NOT NULL DEFAULT 1, |
|||
PRIMARY KEY (list, address), |
|||
FOREIGN KEY (list) REFERENCES mailing_lists(pk) ON DELETE CASCADE |
|||
); |
|||
INSERT INTO membership SELECT list,address,name,digest,hide_address,receive_own_posts,receive_duplicates,receive_confirmation FROM membership_backup; |
|||
DROP TABLE membership_backup; |
|||
PRAGMA foreign_keys = true; |
|||
COMMIT TRANSACTION; |
@ -0,0 +1,5 @@ |
|||
-- Your SQL goes here |
|||
|
|||
PRAGMA foreign_keys = false; |
|||
ALTER TABLE membership ADD COLUMN enabled BOOLEAN CHECK (enabled in (0, 1)) NOT NULL DEFAULT 1; |
|||
PRAGMA foreign_keys = true; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue