Skip to content

Commit eec82cc

Browse files
committed
Ruby/QL: move databaseMetadata to prefix.dbscheme
This has no effect on ruby.dbscheme, and adds the relation to ql.dbscheme.
1 parent 1e68a7e commit eec82cc

File tree

4 files changed

+48
-33
lines changed

4 files changed

+48
-33
lines changed

ql/ql/src/ql.dbscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
108108

109109
@yaml_locatable = @yaml_node | @yaml_error;
110110

111+
/*- Database metadata -*/
112+
databaseMetadata(
113+
string metadataKey: string ref,
114+
string value: string ref
115+
);
116+
111117
/*- QL dbscheme -*/
112118
@ql_add_expr_left_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable
113119

ql/ql/src/ql.dbscheme.stats

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22436,5 +22436,41 @@
2243622436
</dep>
2243722437
</dependencies>
2243822438
</relation>
22439+
<relation>
22440+
<name>databaseMetadata</name>
22441+
<cardinality>1</cardinality>
22442+
<columnsizes>
22443+
<e>
22444+
<k>metadataKey</k>
22445+
<v>1</v>
22446+
</e>
22447+
<e>
22448+
<k>value</k>
22449+
<v>1</v>
22450+
</e>
22451+
</columnsizes>
22452+
<dependencies>
22453+
<dep>
22454+
<src>metadataKey</src>
22455+
<trg>value</trg>
22456+
<val>
22457+
<hist>
22458+
<budget>12</budget>
22459+
<bs/>
22460+
</hist>
22461+
</val>
22462+
</dep>
22463+
<dep>
22464+
<src>value</src>
22465+
<trg>metadataKey</trg>
22466+
<val>
22467+
<hist>
22468+
<budget>12</budget>
22469+
<bs/>
22470+
</hist>
22471+
</val>
22472+
</dep>
22473+
</dependencies>
22474+
</relation>
2243922475
</stats>
2244022476
</dbstats>

shared/tree-sitter-extractor/src/generator/mod.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ pub fn generate(
3333

3434
writeln!(dbscheme_writer, include_str!("prefix.dbscheme"))?;
3535

36-
// Eventually all languages will have the metadata relation (for overlay support), at which
37-
// point this could be moved to prefix.dbscheme.
38-
if overlay_support {
39-
writeln!(dbscheme_writer, "/*- Database metadata -*/",)?;
40-
dbscheme::write(
41-
&mut dbscheme_writer,
42-
&[dbscheme::Entry::Table(create_database_metadata())],
43-
)?;
44-
}
45-
4636
let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
4737
writeln!(
4838
ql_writer,
@@ -478,26 +468,3 @@ fn create_token_case<'a>(name: &'a str, token_kinds: Map<&'a str, usize>) -> dbs
478468
branches,
479469
}
480470
}
481-
482-
fn create_database_metadata() -> dbscheme::Table<'static> {
483-
dbscheme::Table {
484-
name: "databaseMetadata",
485-
keysets: None,
486-
columns: vec![
487-
dbscheme::Column {
488-
db_type: dbscheme::DbColumnType::String,
489-
name: "metadataKey",
490-
unique: false,
491-
ql_type: ql::Type::String,
492-
ql_type_is_ref: true,
493-
},
494-
dbscheme::Column {
495-
db_type: dbscheme::DbColumnType::String,
496-
name: "value",
497-
unique: false,
498-
ql_type: ql::Type::String,
499-
ql_type_is_ref: true,
500-
},
501-
],
502-
}
503-
}

shared/tree-sitter-extractor/src/generator/prefix.dbscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,9 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
104104
int location: @location_default ref);
105105

106106
@yaml_locatable = @yaml_node | @yaml_error;
107+
108+
/*- Database metadata -*/
109+
databaseMetadata(
110+
string metadataKey: string ref,
111+
string value: string ref
112+
);

0 commit comments

Comments
 (0)