db

package
v0.0.0-...-5f8c1fa Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DropOrder = []string{
	"ar_internal_metadata",
	"bulk_delete_jobs",
	"bulk_delete_jobs_emails",
	"bulk_delete_jobs_generic_files",
	"bulk_delete_jobs_institutions",
	"bulk_delete_jobs_intellectual_objects",
	"confirmation_tokens",
	"emails",
	"emails_generic_files",
	"emails_intellectual_objects",
	"emails_premis_events",
	"emails_work_items",
	"old_passwords",
	"schema_migrations",
	"snapshots",
	"usage_samples",
	"alerts_work_items",
	"alerts_users",
	"alerts_premis_events",
	"alerts",
	"deletion_requests_generic_files",
	"deletion_requests_intellectual_objects",
	"deletion_requests",
	"work_items",
	"premis_events",
	"storage_records",
	"checksums",
	"generic_files",
	"intellectual_objects",
	"roles_users",
	"users",
	"institutions",
	"roles",
	"storage_options",
	"historical_deposit_stats",
}

DropOrder lists tables to be dropped, in the order they should be dropped so we don't violate foreign key constraints.

View Source
var HasNoIDColumn = []string{
	"roles_users",
	"deletion_requests_generic_files",
	"deletion_requests_intellectual_objects",
	"alerts_premis_events",
	"alerts_users",
	"alerts_work_items",
}

HasNoIDColumn lists tables that have no identity column. Attempting to reset the id sequences on these tables will cause an error.

View Source
var LoadOrder = []string{
	"storage_options",
	"institutions",
	"users",
	"intellectual_objects",
	"generic_files",
	"checksums",
	"storage_records",
	"premis_events",
	"work_items",
	"deletion_requests",
	"deletion_requests_generic_files",
	"deletion_requests_intellectual_objects",
	"alerts",
	"alerts_premis_events",
	"alerts_users",
	"alerts_work_items",
}

LoadOrder lists the names of tables for which we have fixture data (csv files) in the order they should be loaded.

View Source
var MaterializedViewDropOrder = []string{
	"current_deposit_stats",
	"premis_event_counts",
	"intellectual_object_counts",
	"generic_file_counts",
	"work_item_counts",
}
View Source
var SafeEnvironments = []string{
	"dev",
	"integration",
	"test",
	"travis",
}

SafeEnvironments lists which APT_ENV environments are safe for data loading. Since data loading DELETES THE ENTIRE DB before reloading fixtures, we want this to run only on local dev machines and test/CI systems.

Functions

func ForceFixtureReload

func ForceFixtureReload() error

ForceFixtureReload forces reloading of all test fixtures. This is useful when you want to ensure a clean slate, wiping out all records left by prior tests.

func LoadFixtures

func LoadFixtures() error

LoadFixtures wipes out and resets the test database, loading all of the fixtures we use for unit and intergration tests. This method effectively runs only once per test run. All calls to this function after the first call are no-ops to prevent time-consuming reloading of DB for each test.

If you truly want to force a reloading of all fixtures, call ForceFixtureReload().

This will panic if run in any APT_ENV other than "test" or "integration".

Types

This section is empty.

Jump to

Keyboard shortcuts

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