func (f Flags) CreateDatabase(ctx context.Context, driverName string, e EmbeddedData) (*db.Database, error) {
	cfg := f.sqlDatabaseConfig()
	sqlDB, err := sql.Open(driverName, f.DatabaseURL)
	if err != nil {
		return nil, fmt.Errorf("opening database %w", err)
	}
	db, err := cfg.NewDatabase(sqlDB)
	if err != nil {
		return nil, fmt.Errorf("creating SQL database: %w", err)
	}
	setupSQL, err := e.sqlFiles()
	if err != nil {
		return nil, err
	}
	if err := db.Setup(ctx, setupSQL); err != nil {
		return nil, fmt.Errorf("setting up SQL database: %w", err)
	}
	return db, nil
}
// CreateDatabase creates and sets up the database.
CreateDatabase creates and sets up the database.
// CreateDatabase creates and sets up the database .
func (f Flags) CreateDatabase(ctx context.Context, driverName string, e EmbeddedData) (*db.Database, error) {
	cfg := f.sqlDatabaseConfig()
	sqlDB, err := sql.Open(driverName, f.DatabaseURL)
	if err != nil {
		return nil, fmt.Errorf("opening database %w", err)
	}
	db, err := cfg.NewDatabase(sqlDB)
	if err != nil {
		return nil, fmt.Errorf("creating SQL database: %w", err)
	}
	setupSQL, err := e.sqlFiles()
	if err != nil {
		return nil, err
	}
	if err := db.Setup(ctx, setupSQL); err != nil {
		return nil, fmt.Errorf("setting up SQL database: %w", err)
	}
	return db, nil
}
func ( f Flags ) CreateDatabase ( ctx context . Context , driverName string , e EmbeddedData ) ( * db . Database , error ) { cfg := f . sqlDatabaseConfig ( ) sqlDB , err := sql . Open ( driverName , f . DatabaseURL ) if err != nil { return nil , fmt . Errorf ( " " , err ) } db , err := cfg . NewDatabase ( sqlDB ) if err != nil { return nil , fmt . Errorf ( " " , err ) } setupSQL , err := e . sqlFiles ( ) if err != nil { return nil , err } if err := db . Setup ( ctx , setupSQL ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return db , nil }
CreateDatabase creates and sets up the database.
CreateDatabase creates and sets up the database .