sql

package
v0.0.0-...-81cd3a7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 37 Imported by: 0

README

SQL Migrations

To create a new fizz migration run in the project root:

$ name=
$ ory dev pop migration create ./persistence/sql/migrations/templates $name

To create SQL migrations, target each database individually and run

$ dialect=mysql  # or postgres|cockroach|sqlite
$ name=
$ ory dev pop migration create -d=$dialect ./persistence/sql/migrations/templates $name
$ soda generate sql -e mysql -c ./persistence/sql/.soda.yml -p ./persistence/sql/migrations/templates [name]
$ soda generate sql -e sqlite -c ./persistence/sql/.soda.yml -p ./persistence/sql/migrations/templates [name]
$ soda generate sql -e postgres -c ./persistence/sql/.soda.yml -p ./persistence/sql/migrations/templates [name]
$ soda generate sql -e cockroach -c ./persistence/sql/.soda.yml -p ./persistence/sql/migrations/templates [name]

and remove the sqlite part from the newly generated file to create a SQL migrations that works with all aforementioned databases.

Rendering Migrations

Because migrations needs to be backwards compatible, and because fizz migrations might change, we render fizz migrations to raw SQL statements using make migrations-render.

The concrete migrations being applied can be found in ./migrations/sql.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTransaction

func WithTransaction(ctx context.Context, tx *pop.Connection) context.Context

Types

type Persister

type Persister struct {
	// contains filtered or unexported fields
}

func NewPersister

func NewPersister(r persisterDependencies, conf configuration.Provider, c *pop.Connection) (*Persister, error)

func (*Persister) Add

func (p *Persister) Add(ctx context.Context, csrfToken string, errs ...error) (uuid.UUID, error)

func (*Persister) AddMessage

func (p *Persister) AddMessage(ctx context.Context, m *courier.Message) error

func (*Persister) Clear

func (p *Persister) Clear(ctx context.Context, olderThan time.Duration, force bool) (err error)

func (*Persister) Close

func (p *Persister) Close(ctx context.Context) error

func (*Persister) Connection

func (p *Persister) Connection() *pop.Connection

func (*Persister) CountIdentities

func (p *Persister) CountIdentities(ctx context.Context) (int64, error)

func (*Persister) CreateIdentity

func (p *Persister) CreateIdentity(ctx context.Context, i *identity.Identity) error

func (*Persister) CreateLoginFlow

func (p *Persister) CreateLoginFlow(ctx context.Context, r *login.Flow) error

func (Persister) CreateRecoveryFlow

func (p Persister) CreateRecoveryFlow(ctx context.Context, r *recovery.Flow) error

func (*Persister) CreateRecoveryToken

func (p *Persister) CreateRecoveryToken(ctx context.Context, token *link.RecoveryToken) error

func (*Persister) CreateRegistrationFlow

func (p *Persister) CreateRegistrationFlow(ctx context.Context, r *registration.Flow) error

func (*Persister) CreateSession

func (p *Persister) CreateSession(ctx context.Context, s *session.Session) error

func (*Persister) CreateSettingsFlow

func (p *Persister) CreateSettingsFlow(ctx context.Context, r *settings.Flow) error

func (Persister) CreateVerificationFlow

func (p Persister) CreateVerificationFlow(ctx context.Context, r *verification.Flow) error

func (*Persister) CreateVerificationToken

func (p *Persister) CreateVerificationToken(ctx context.Context, token *link.VerificationToken) error

func (*Persister) DeleteContinuitySession

func (p *Persister) DeleteContinuitySession(ctx context.Context, id uuid.UUID) error

func (*Persister) DeleteIdentity

func (p *Persister) DeleteIdentity(ctx context.Context, id uuid.UUID) error

func (*Persister) DeleteRecoveryToken

func (p *Persister) DeleteRecoveryToken(ctx context.Context, token string) error

func (*Persister) DeleteSession

func (p *Persister) DeleteSession(ctx context.Context, sid uuid.UUID) error

func (*Persister) DeleteSessionByToken

func (p *Persister) DeleteSessionByToken(ctx context.Context, token string) error

func (*Persister) DeleteSessionsByIdentity

func (p *Persister) DeleteSessionsByIdentity(ctx context.Context, identityID uuid.UUID) error

func (*Persister) DeleteVerificationToken

func (p *Persister) DeleteVerificationToken(ctx context.Context, token string) error

func (*Persister) FindByCredentialsIdentifier

func (p *Persister) FindByCredentialsIdentifier(ctx context.Context, ct identity.CredentialsType, match string) (*identity.Identity, *identity.Credentials, error)

func (*Persister) FindRecoveryAddressByValue

func (p *Persister) FindRecoveryAddressByValue(ctx context.Context, via identity.RecoveryAddressType, value string) (*identity.RecoveryAddress, error)

func (*Persister) FindVerifiableAddressByValue

func (p *Persister) FindVerifiableAddressByValue(ctx context.Context, via identity.VerifiableAddressType, value string) (*identity.VerifiableAddress, error)

func (*Persister) ForceLoginFlow

func (p *Persister) ForceLoginFlow(ctx context.Context, id uuid.UUID) error

func (*Persister) GetConnection

func (p *Persister) GetConnection(ctx context.Context) *pop.Connection

func (*Persister) GetContinuitySession

func (p *Persister) GetContinuitySession(ctx context.Context, id uuid.UUID) (*continuity.Container, error)

func (*Persister) GetIdentity

func (p *Persister) GetIdentity(ctx context.Context, id uuid.UUID) (*identity.Identity, error)

func (*Persister) GetIdentityConfidential

func (p *Persister) GetIdentityConfidential(ctx context.Context, id uuid.UUID) (*identity.Identity, error)

func (*Persister) GetLoginFlow

func (p *Persister) GetLoginFlow(ctx context.Context, id uuid.UUID) (*login.Flow, error)

func (Persister) GetRecoveryFlow

func (p Persister) GetRecoveryFlow(ctx context.Context, id uuid.UUID) (*recovery.Flow, error)

func (*Persister) GetRegistrationFlow

func (p *Persister) GetRegistrationFlow(ctx context.Context, id uuid.UUID) (*registration.Flow, error)

func (*Persister) GetSession

func (p *Persister) GetSession(ctx context.Context, sid uuid.UUID) (*session.Session, error)

func (*Persister) GetSessionByToken

func (p *Persister) GetSessionByToken(ctx context.Context, token string) (*session.Session, error)

func (*Persister) GetSettingsFlow

func (p *Persister) GetSettingsFlow(ctx context.Context, id uuid.UUID) (*settings.Flow, error)

func (Persister) GetVerificationFlow

func (p Persister) GetVerificationFlow(ctx context.Context, id uuid.UUID) (*verification.Flow, error)

func (*Persister) LatestQueuedMessage

func (p *Persister) LatestQueuedMessage(ctx context.Context) (*courier.Message, error)

func (*Persister) ListIdentities

func (p *Persister) ListIdentities(ctx context.Context, page, perPage int) ([]identity.Identity, error)

func (*Persister) ListRecoveryAddresses

func (p *Persister) ListRecoveryAddresses(ctx context.Context, page, itemsPerPage int) (a []identity.RecoveryAddress, err error)

func (*Persister) ListVerifiableAddresses

func (p *Persister) ListVerifiableAddresses(ctx context.Context, page, itemsPerPage int) (a []identity.VerifiableAddress, err error)

func (*Persister) MigrateDown

func (p *Persister) MigrateDown(ctx context.Context, steps int) error

func (*Persister) MigrateUp

func (p *Persister) MigrateUp(ctx context.Context) error

func (*Persister) MigrationStatus

func (p *Persister) MigrationStatus(ctx context.Context, w io.Writer) error

func (*Persister) NextMessages

func (p *Persister) NextMessages(ctx context.Context, limit uint8) ([]courier.Message, error)

func (*Persister) Ping

func (p *Persister) Ping(ctx context.Context) error

func (*Persister) Read

func (*Persister) RevokeSessionByToken

func (p *Persister) RevokeSessionByToken(ctx context.Context, token string) error

func (*Persister) SaveContinuitySession

func (p *Persister) SaveContinuitySession(ctx context.Context, c *continuity.Container) error

func (*Persister) SetMessageStatus

func (p *Persister) SetMessageStatus(ctx context.Context, id uuid.UUID, ms courier.MessageStatus) error

func (*Persister) Transaction

func (p *Persister) Transaction(ctx context.Context, callback func(ctx context.Context, connection *pop.Connection) error) error

func (*Persister) UpdateIdentity

func (p *Persister) UpdateIdentity(ctx context.Context, i *identity.Identity) error

func (*Persister) UpdateLoginFlow

func (p *Persister) UpdateLoginFlow(ctx context.Context, r *login.Flow) error

func (*Persister) UpdateLoginFlowMethod

func (p *Persister) UpdateLoginFlowMethod(ctx context.Context, id uuid.UUID, ct identity.CredentialsType, rm *login.FlowMethod) error

func (Persister) UpdateRecoveryFlow

func (p Persister) UpdateRecoveryFlow(ctx context.Context, r *recovery.Flow) error

func (*Persister) UpdateRegistrationFlow

func (p *Persister) UpdateRegistrationFlow(ctx context.Context, r *registration.Flow) error

func (*Persister) UpdateRegistrationFlowMethod

func (p *Persister) UpdateRegistrationFlowMethod(ctx context.Context, id uuid.UUID, ct identity.CredentialsType, rm *registration.FlowMethod) error

func (*Persister) UpdateSettingsFlow

func (p *Persister) UpdateSettingsFlow(ctx context.Context, r *settings.Flow) error

func (*Persister) UpdateSettingsFlowMethod

func (p *Persister) UpdateSettingsFlowMethod(ctx context.Context, id uuid.UUID, method string, fm *settings.FlowMethod) error

func (*Persister) UpdateVerifiableAddress

func (p *Persister) UpdateVerifiableAddress(ctx context.Context, address *identity.VerifiableAddress) error

func (Persister) UpdateVerificationFlow

func (p Persister) UpdateVerificationFlow(ctx context.Context, r *verification.Flow) error

func (*Persister) UseRecoveryToken

func (p *Persister) UseRecoveryToken(ctx context.Context, token string) (*link.RecoveryToken, error)

func (*Persister) UseVerificationToken

func (p *Persister) UseVerificationToken(ctx context.Context, token string) (*link.VerificationToken, error)

func (*Persister) VerifyAddress

func (p *Persister) VerifyAddress(ctx context.Context, code string) error

Jump to

Keyboard shortcuts

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