小编Pee*_*ech的帖子

表没有phpMyAdmin中的唯一列

这是我的表:

CREATE TABLE group_edits (
  vfile_id bigint(20) unsigned NOT NULL,
  editor_id int(10) unsigned NOT NULL,
  edits text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)

没有唯一索引,因为一个editor_id可以编辑多个vfile_id,也可以通过多个editor_id编辑一个vfile_id.

phpMyAdmin 4.1.6不允许我编辑这个表说:

Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.
Run Code Online (Sandbox Code Playgroud)

现在它让我觉得这样的桌子有什么问题吗?当您获取editor_id和vfile_id的值时,行是唯一的,而单独的列都不是唯一的.

我知道要修复它我可以添加

`ID` int(11) NOT NULL AUTO_INCREMENT,
Run Code Online (Sandbox Code Playgroud)

但它并不反映我的数据库架构的设计,我想避免添加技巧只是为了使phpMyAdmin工作.

我的数据库设计是错误的还是phpMyAdmin?

mysql phpmyadmin

4
推荐指数
1
解决办法
2万
查看次数

在 Rust 测试中使用外部文件

我正在编写一个从文件中读取文件内容的服务,该文件的位置是从 env 变量中读取的FILE_LOCATION

fn my_function(){
    let path = match env::var("FILE_LOCATION") {
    ...
    let contents = match fs::read(&path) {
}

Run Code Online (Sandbox Code Playgroud)

我有一个测试文件test_file.json

proj
  resources
    test
      test_file.json
  src
    main.rs
  tests
    unit_tests.rs

Run Code Online (Sandbox Code Playgroud)

在测试中我可以设置FILE_LOCATION

env::set_var("FILE_LOCATION", "path/to/test/file");
Run Code Online (Sandbox Code Playgroud)

问题是 的值应该是path/to/test/file多少?

或者换句话说:

如何在 Rust 测试中访问外部文件?

unit-testing rust

3
推荐指数
1
解决办法
754
查看次数

标签 统计

mysql ×1

phpmyadmin ×1

rust ×1

unit-testing ×1