Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [#539] Remove the SQL migrator module #809

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
276 changes: 0 additions & 276 deletions database/console/driver/sqlite.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"github.com/goravel/framework/support/str"
)

type DefaultCreator struct {
type Creator struct {
}

func NewDefaultCreator() *DefaultCreator {
return &DefaultCreator{}
func NewCreator() *Creator {
return &Creator{}
}

// GetStub Get the migration stub file.
func (r *DefaultCreator) GetStub(table string, create bool) string {
func (r *Creator) GetStub(table string, create bool) string {
if table == "" {
return Stubs{}.Empty()
}
Expand All @@ -31,7 +31,7 @@ func (r *DefaultCreator) GetStub(table string, create bool) string {
}

// PopulateStub Populate the place-holders in the migration stub.
func (r *DefaultCreator) PopulateStub(stub, signature, table string) string {
func (r *Creator) PopulateStub(stub, signature, table string) string {
stub = strings.ReplaceAll(stub, "DummyMigration", str.Of(signature).Prepend("m_").Studly().String())
stub = strings.ReplaceAll(stub, "DummySignature", signature)
stub = strings.ReplaceAll(stub, "DummyTable", table)
Expand All @@ -40,13 +40,13 @@ func (r *DefaultCreator) PopulateStub(stub, signature, table string) string {
}

// GetPath Get the full path to the migration.
func (r *DefaultCreator) GetPath(name string) string {
func (r *Creator) GetPath(name string) string {
pwd, _ := os.Getwd()

return filepath.Join(pwd, "database", "migrations", name+".go")
}

// GetFileName Get the full path to the migration.
func (r *DefaultCreator) GetFileName(name string) string {
func (r *Creator) GetFileName(name string) string {
return fmt.Sprintf("%s_%s", carbon.Now().ToShortDateTimeString(), name)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (

type DefaultCreatorSuite struct {
suite.Suite
defaultCreator *DefaultCreator
defaultCreator *Creator
}

func TestDefaultCreatorSuite(t *testing.T) {
suite.Run(t, &DefaultCreatorSuite{})
}

func (s *DefaultCreatorSuite) SetupTest() {
s.defaultCreator = NewDefaultCreator()
s.defaultCreator = NewCreator()
}

func (s *DefaultCreatorSuite) TestPopulateStub() {
Expand Down
Loading
Loading