StoreSchema
See source codeTable of contents
class StoreSchema<R extends UnknownRecord, P = unknown> {}
Properties
migrations
readonly
readonly migrations: Record<string, MigrationSequence>
sortedMigrations
readonly
readonly sortedMigrations: readonly Migration[]
types
readonly
readonly types: {
  [Record in R as Record['typeName']]: RecordType<R, any>
}
Methods
create()
static
static create<R extends UnknownRecord, P = unknown>(
  types: {
    [TypeName in R['typeName']]: {
      createId: any
    }
  },
  options?: StoreSchemaOptions<R, P>
): StoreSchema<R, P>
Parameters
| Name | Description | 
|---|---|
  |  | 
  |  | 
Returns
StoreSchema<R, P>
getMigrationsSince()
getMigrationsSince(
  persistedSchema: SerializedSchema
): Result<Migration[], string>
Parameters
| Name | Description | 
|---|---|
  | 
Returns
Result<Migration[], string>
migratePersistedRecord()
migratePersistedRecord(
  record: R,
  persistedSchema: SerializedSchema,
  direction?: 'down' | 'up'
): MigrationResult<R>
Parameters
| Name | Description | 
|---|---|
  |  | 
  | |
  |  | 
Returns
migrateStoreSnapshot()
migrateStoreSnapshot(
  snapshot: StoreSnapshot<R>
): MigrationResult<SerializedStore<R>>
Parameters
| Name | Description | 
|---|---|
  | 
Returns
serialize()
serialize(): SerializedSchemaV2
serializeEarliestVersion()
serializeEarliestVersion(): SerializedSchema
validateRecord()
validateRecord(
  store: Store<R>,
  record: R,
  phase: 'createRecord' | 'initialize' | 'tests' | 'updateRecord',
  recordBefore: null | R
): R
Parameters
| Name | Description | 
|---|---|
  |  | 
  |  | 
  |  | 
  |  | 
Returns
R
Prev
StoreQueriesNext
StoreSideEffects