migrate

package
v1.0.1-0...-a87b900 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2013 bee authors

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportDatabaseTable

func ExportDatabaseTable() ([]string, error)

导出数据库的表结构

func RegisterMigration

func RegisterMigration()

func RunMigration

func RunMigration()

Types

type MigrationDatabase

type MigrationDatabase interface {
	//获取当前的版本
	Version() int64
	//校验当前是否可更新
	ValidUpdate(version int64) error
	//校验并备份表结构
	ValidForBackupTableSchema() error
	//校验并更新表结构
	ValidForUpdateTableSchema() error
	//恢复旧数据
	MigrationOldTableData() error
	//插入新数据
	MigrationNewTableData() error
	//增加迁移记录
	AddMigrationRecord(version int64) error
	//最后的清理工作
	MigrationCleanup() error
	//回滚本次迁移
	RollbackMigration() error
}

type MigrationVersion03

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

func NewMigrationVersion03

func NewMigrationVersion03() *MigrationVersion03

func (*MigrationVersion03) AddMigrationRecord

func (m *MigrationVersion03) AddMigrationRecord(version int64) error

func (*MigrationVersion03) MigrationCleanup

func (m *MigrationVersion03) MigrationCleanup() error

func (*MigrationVersion03) MigrationNewTableData

func (m *MigrationVersion03) MigrationNewTableData() error

func (*MigrationVersion03) MigrationOldTableData

func (m *MigrationVersion03) MigrationOldTableData() error

func (*MigrationVersion03) RollbackMigration

func (m *MigrationVersion03) RollbackMigration() error

func (*MigrationVersion03) ValidForBackupTableSchema

func (m *MigrationVersion03) ValidForBackupTableSchema() error

func (*MigrationVersion03) ValidForUpdateTableSchema

func (m *MigrationVersion03) ValidForUpdateTableSchema() error

func (*MigrationVersion03) ValidUpdate

func (m *MigrationVersion03) ValidUpdate(version int64) error

func (*MigrationVersion03) Version

func (m *MigrationVersion03) Version() int64

Jump to

Keyboard shortcuts

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