in Sources/XCMetricsBackendLib/Common/Repositories/Postgress/Migrations/CreateSwiftFunction.swift [24:53]
func prepare(on database: Database) -> EventLoopFuture<Void> {
if let sql = database as? SQLDatabase {
return sql.raw("""
CREATE TABLE swift_functions (
id uuid,
day date NOT NULL,
build_identifier text NOT NULL,
step_identifier text NOT NULL,
file text NOT NULL,
signature text NOT NULL,
starting_line integer NOT NULL,
starting_column integer NOT NULL,
duration double precision NOT NULL,
occurrences integer NOT NULL,
PRIMARY KEY (id, day)
) PARTITION BY LIST (day);
""").run()
}
return database.schema("swift_functions")
.id()
.field("build_identifier", .string, .required)
.field("step_identifier", .string, .required)
.field("file", .string, .required)
.field("signature", .string, .required)
.field("starting_line", .int32, .required)
.field("starting_column", .int32, .required)
.field("duration", .double, .required)
.field("occurrences", .int32, .required)
.create()
}