repository

package
v0.0.0-...-ca0f7d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations = []*migrate.Migration{
	{
		Id: "20200121000001_create_account_status_type",
		Up: []string{
			`
			CREATE TYPE account_status AS ENUM ('unconfirmed', 'confirmed', 'deleted', 'banned')`,
		},
		Down: []string{
			`
			DROP TYPE account_status CASCADE;
			`,
		},
	},
	{
		Id: "20200121000002_create_account_type",
		Up: []string{
			`
			CREATE TYPE account_type AS ENUM ('free', 'commercial')`,
		},
		Down: []string{
			`
			DROP TYPE account_type CASCADE;
			`,
		},
	},
	{
		Id: "20200121000003_create_accounts_table",
		Up: []string{
			`
			CREATE TABLE accounts
			(
				id 						uuid not null primary key,
				account_type			account_type not null,
				account_status			account_status not null default 'unconfirmed',
				account_name			text not null,
				profile					jsonb,
				settings				jsonb,
				last_ip					text,
				last_login	 			timestamp with time zone not null default now(),
				created_at	 			timestamp with time zone not null default now(),
				updated_at	 			timestamp with time zone not null default now()
			);
			`,
		},
	},
	{
		Id: "20200122000004_create_accounts_table_account_name_active_account_uniq_idx_index",
		Up: []string{
			`
			CREATE UNIQUE INDEX
				accounts_account_name_active_account_uniq_idx ON accounts (account_name)
			WHERE account_status != 'deleted' AND account_status != 'banned';
			`,
		},
		Down: []string{
			`
			DROP INDEX accounts_account_name_not_null_uniq_idx;
			`,
		},
	},
}

Migrations a list of migrations to create/update/rollback database

Functions

func New

func New() (account.Repository, error)

New creates postgresRepository

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL