This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactoring (switch to go-pg, basis for plans (#4), code cleanu…
…p) (#13)
- Loading branch information
1 parent
abd2050
commit 5e51304
Showing
93 changed files
with
2,590 additions
and
1,597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/go-pg/migrations/v8" | ||
"github.com/go-pg/pg/v10/orm" | ||
"github.com/woningfinder/woningfinder/internal/bootstrap" | ||
"github.com/woningfinder/woningfinder/internal/domain/entity" | ||
) | ||
|
||
func init() { | ||
// register m2m models with go-pg | ||
bootstrap.RegisterModel() | ||
|
||
// models | ||
models := []interface{}{ | ||
(*entity.CorporationCity)(nil), | ||
(*entity.CorporationSelectionMethod)(nil), | ||
(*entity.HousingPreferencesHousingType)(nil), | ||
(*entity.HousingPreferencesCity)(nil), | ||
|
||
(*entity.Corporation)(nil), | ||
(*entity.SelectionMethod)(nil), | ||
(*entity.HousingType)(nil), | ||
(*entity.City)(nil), | ||
(*entity.User)(nil), | ||
(*entity.Tier)(nil), | ||
(*entity.HousingPreferences)(nil), | ||
(*entity.HousingPreferencesCityDistrict)(nil), | ||
(*entity.HousingPreferencesMatch)(nil), | ||
(*entity.CorporationCredentials)(nil), | ||
} | ||
|
||
migrations.MustRegisterTx(func(db migrations.DB) error { | ||
for _, model := range models { | ||
err := db.Model(model).CreateTable(&orm.CreateTableOptions{ | ||
IfNotExists: true, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
}) | ||
} |
Oops, something went wrong.