1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-30 19:22:11 +00:00

refactor(database): remove implicit not null constraint for serial types

- The (big)serial keyword is already `not null`, so no need to it explicitly.
  See https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL
This commit is contained in:
Julien Voisin 2025-09-28 22:13:54 +02:00 committed by GitHub
parent 1a29c1568c
commit 1620f8d3f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,7 +20,7 @@ var migrations = [...]func(tx *sql.Tx) error{
); );
CREATE TABLE users ( CREATE TABLE users (
id serial not null, id SERIAL,
username text not null unique, username text not null unique,
password text, password text,
is_admin bool default 'f', is_admin bool default 'f',
@ -32,7 +32,7 @@ var migrations = [...]func(tx *sql.Tx) error{
); );
CREATE TABLE sessions ( CREATE TABLE sessions (
id serial not null, id SERIAL,
user_id int not null, user_id int not null,
token text not null unique, token text not null unique,
created_at timestamp with time zone default now(), created_at timestamp with time zone default now(),
@ -44,7 +44,7 @@ var migrations = [...]func(tx *sql.Tx) error{
); );
CREATE TABLE categories ( CREATE TABLE categories (
id serial not null, id SERIAL,
user_id int not null, user_id int not null,
title text not null, title text not null,
primary key (id), primary key (id),
@ -53,7 +53,7 @@ var migrations = [...]func(tx *sql.Tx) error{
); );
CREATE TABLE feeds ( CREATE TABLE feeds (
id bigserial not null, id BIGSERIAL,
user_id int not null, user_id int not null,
category_id int not null, category_id int not null,
title text not null, title text not null,
@ -73,7 +73,7 @@ var migrations = [...]func(tx *sql.Tx) error{
CREATE TYPE entry_status as enum('unread', 'read', 'removed'); CREATE TYPE entry_status as enum('unread', 'read', 'removed');
CREATE TABLE entries ( CREATE TABLE entries (
id bigserial not null, id BIGSERIAL,
user_id int not null, user_id int not null,
feed_id bigint not null, feed_id bigint not null,
hash text not null, hash text not null,
@ -92,7 +92,7 @@ var migrations = [...]func(tx *sql.Tx) error{
CREATE INDEX entries_feed_idx on entries using btree(feed_id); CREATE INDEX entries_feed_idx on entries using btree(feed_id);
CREATE TABLE enclosures ( CREATE TABLE enclosures (
id bigserial not null, id BIGSERIAL,
user_id int not null, user_id int not null,
entry_id bigint not null, entry_id bigint not null,
url text not null, url text not null,
@ -104,7 +104,7 @@ var migrations = [...]func(tx *sql.Tx) error{
); );
CREATE TABLE icons ( CREATE TABLE icons (
id bigserial not null, id BIGSERIAL,
hash text not null unique, hash text not null unique,
mime_type text not null, mime_type text not null,
content bytea not null, content bytea not null,
@ -334,7 +334,7 @@ var migrations = [...]func(tx *sql.Tx) error{
func(tx *sql.Tx) (err error) { func(tx *sql.Tx) (err error) {
sql := ` sql := `
CREATE TABLE api_keys ( CREATE TABLE api_keys (
id serial not null, id SERIAL,
user_id int not null references users(id) on delete cascade, user_id int not null references users(id) on delete cascade,
token text not null unique, token text not null unique,
description text not null, description text not null,