align types between sqlite & postgres

this one's achieved by adding "NOT NULL" at the *correct* position in
SQLite's create tables.
This commit is contained in:
Igor Galić 2018-09-17 11:08:58 +02:00
parent b28bef20a7
commit 88456faf84
No known key found for this signature in database
GPG key ID: ACFEFF7F6A123A86
15 changed files with 28 additions and 28 deletions

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE instances (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
public_domain VARCHAR NOT NULL,
name VARCHAR NOT NULL,
local BOOLEAN NOT NULL DEFAULT 'f',

View file

@ -1,7 +1,7 @@
-- Your SQL goes here
PRAGMA foreign_keys = ON;
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
username VARCHAR NOT NULL,
display_name VARCHAR NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL,

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE blogs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
actor_id VARCHAR NOT NULL,
title VARCHAR NOT NULL,
summary TEXT NOT NULL DEFAULT '',

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE blog_authors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
blog_id INTEGER REFERENCES blogs(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
is_owner BOOLEAN NOT NULL DEFAULT 'f'

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
blog_id INTEGER REFERENCES blogs(id) ON DELETE CASCADE NOT NULL,
slug VARCHAR NOT NULL,
title VARCHAR NOT NULL,

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE post_authors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL
)

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE follows (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
follower_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
following_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
ap_url TEXT NOT NULL default ''

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
content TEXT NOT NULL DEFAULT '',
in_response_to_id INTEGER REFERENCES comments(id),
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE likes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
ap_url VARCHAR NOT NULL default '',

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
kind VARCHAR NOT NULL DEFAULT 'unknown',

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE reshares (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
ap_url VARCHAR NOT NULL DEFAULT '',

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE mentions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
mentioned_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE,
comment_id INTEGER REFERENCES comments(id) ON DELETE CASCADE,

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE medias (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
file_path TEXT NOT NULL DEFAULT '',
alt_text TEXT NOT NULL DEFAULT '',
is_remote BOOLEAN NOT NULL DEFAULT 'f',

View file

@ -1,6 +1,6 @@
-- Your SQL goes here
CREATE TABLE tags (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
tag TEXT NOT NULL DEFAULT '',
is_hastag BOOLEAN NOT NULL DEFAULT 'f',
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL

View file

@ -1,6 +1,6 @@
table! {
blog_authors (id) {
id -> Nullable<Integer>,
id -> Integer,
blog_id -> Integer,
author_id -> Integer,
is_owner -> Bool,
@ -9,7 +9,7 @@ table! {
table! {
blogs (id) {
id -> Nullable<Integer>,
id -> Integer,
actor_id -> Text,
title -> Text,
summary -> Text,
@ -25,7 +25,7 @@ table! {
table! {
comments (id) {
id -> Nullable<Integer>,
id -> Integer,
content -> Text,
in_response_to_id -> Nullable<Integer>,
post_id -> Integer,
@ -39,7 +39,7 @@ table! {
table! {
follows (id) {
id -> Nullable<Integer>,
id -> Integer,
follower_id -> Integer,
following_id -> Integer,
ap_url -> Text,
@ -48,7 +48,7 @@ table! {
table! {
instances (id) {
id -> Nullable<Integer>,
id -> Integer,
public_domain -> Text,
name -> Text,
local -> Bool,
@ -65,7 +65,7 @@ table! {
table! {
likes (id) {
id -> Nullable<Integer>,
id -> Integer,
user_id -> Integer,
post_id -> Integer,
ap_url -> Text,
@ -75,7 +75,7 @@ table! {
table! {
medias (id) {
id -> Nullable<Integer>,
id -> Integer,
file_path -> Text,
alt_text -> Text,
is_remote -> Bool,
@ -88,7 +88,7 @@ table! {
table! {
mentions (id) {
id -> Nullable<Integer>,
id -> Integer,
mentioned_id -> Integer,
post_id -> Nullable<Integer>,
comment_id -> Nullable<Integer>,
@ -98,7 +98,7 @@ table! {
table! {
notifications (id) {
id -> Nullable<Integer>,
id -> Integer,
user_id -> Integer,
creation_date -> Timestamp,
kind -> Text,
@ -108,7 +108,7 @@ table! {
table! {
post_authors (id) {
id -> Nullable<Integer>,
id -> Integer,
post_id -> Integer,
author_id -> Integer,
}
@ -116,7 +116,7 @@ table! {
table! {
posts (id) {
id -> Nullable<Integer>,
id -> Integer,
blog_id -> Integer,
slug -> Text,
title -> Text,
@ -132,7 +132,7 @@ table! {
table! {
reshares (id) {
id -> Nullable<Integer>,
id -> Integer,
user_id -> Integer,
post_id -> Integer,
ap_url -> Text,
@ -142,7 +142,7 @@ table! {
table! {
tags (id) {
id -> Nullable<Integer>,
id -> Integer,
tag -> Text,
is_hastag -> Bool,
post_id -> Integer,
@ -151,7 +151,7 @@ table! {
table! {
users (id) {
id -> Nullable<Integer>,
id -> Integer,
username -> Text,
display_name -> Text,
outbox_url -> Text,