align types between sqlite & postgres

use DATETIME for SQLite's time type. This way, Diesel picks up on what
it's supposed to be.
This commit is contained in:
Igor Galić 2018-09-16 16:22:18 +02:00
parent 1f8680c4c5
commit b28bef20a7
No known key found for this signature in database
GPG Key ID: ACFEFF7F6A123A86
10 changed files with 18 additions and 16 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ Rocket.toml
media
docker-compose.yml
*.db
*.sqlite
*.sqlite3

View File

@ -5,7 +5,7 @@ CREATE TABLE instances (
name VARCHAR NOT NULL,
local BOOLEAN NOT NULL DEFAULT 'f',
blocked BOOLEAN NOT NULL DEFAULT 'f',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
open_registrations BOOLEAN NOT NULL DEFAULT 't',
short_description TEXT NOT NULL DEFAULT '',
long_description TEXT NOT NULL DEFAULT '',

View File

@ -11,7 +11,7 @@ CREATE TABLE users (
email TEXT,
hashed_password TEXT,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url TEXT NOT NULL default '',
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',

View File

@ -7,7 +7,7 @@ CREATE TABLE blogs (
outbox_url VARCHAR NOT NULL,
inbox_url VARCHAR NOT NULL,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url text not null default '',
private_key TEXT,
public_key TEXT NOT NULL DEFAULT ''

View File

@ -7,7 +7,7 @@ CREATE TABLE posts (
content TEXT NOT NULL DEFAULT '',
published BOOLEAN NOT NULL DEFAULT 'f',
license VARCHAR NOT NULL DEFAULT 'CC-0',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url VARCHAR NOT NULL DEFAULT '',
subtitle TEXT NOT NULL DEFAULT '',
source TEXT NOT NULL DEFAULT ''

View File

@ -5,7 +5,7 @@ CREATE TABLE comments (
in_response_to_id INTEGER REFERENCES comments(id),
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url VARCHAR,
sensitive BOOLEAN NOT NULL DEFAULT 'f',
spoiler_text TEXT NOT NULL DEFAULT ''

View File

@ -4,5 +4,5 @@ CREATE TABLE likes (
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 '',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
)

View File

@ -2,7 +2,7 @@
CREATE TABLE notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
kind VARCHAR NOT NULL DEFAULT 'unknown',
object_id INTEGER NOT NULL DEFAULT 0
)

View File

@ -4,5 +4,5 @@ CREATE TABLE reshares (
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 '',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
)

View File

@ -16,7 +16,7 @@ table! {
outbox_url -> Text,
inbox_url -> Text,
instance_id -> Integer,
creation_date -> Integer,
creation_date -> Timestamp,
ap_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,
@ -30,7 +30,7 @@ table! {
in_response_to_id -> Nullable<Integer>,
post_id -> Integer,
author_id -> Integer,
creation_date -> Integer,
creation_date -> Timestamp,
ap_url -> Nullable<Text>,
sensitive -> Bool,
spoiler_text -> Text,
@ -53,7 +53,7 @@ table! {
name -> Text,
local -> Bool,
blocked -> Bool,
creation_date -> Integer,
creation_date -> Timestamp,
open_registrations -> Bool,
short_description -> Text,
long_description -> Text,
@ -69,7 +69,7 @@ table! {
user_id -> Integer,
post_id -> Integer,
ap_url -> Text,
creation_date -> Integer,
creation_date -> Timestamp,
}
}
@ -100,7 +100,7 @@ table! {
notifications (id) {
id -> Nullable<Integer>,
user_id -> Integer,
creation_date -> Integer,
creation_date -> Timestamp,
kind -> Text,
object_id -> Integer,
}
@ -123,7 +123,7 @@ table! {
content -> Text,
published -> Bool,
license -> Text,
creation_date -> Integer,
creation_date -> Timestamp,
ap_url -> Text,
subtitle -> Text,
source -> Text,
@ -136,7 +136,7 @@ table! {
user_id -> Integer,
post_id -> Integer,
ap_url -> Text,
creation_date -> Integer,
creation_date -> Timestamp,
}
}
@ -161,7 +161,7 @@ table! {
email -> Nullable<Text>,
hashed_password -> Nullable<Text>,
instance_id -> Integer,
creation_date -> Integer,
creation_date -> Timestamp,
ap_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,