【发布时间】:2011-07-12 19:01:56
【问题描述】:
在我的 Rails 应用程序中,我希望允许用户通过不同的协议(FTP、SFTP、S3、Dropbox)连接到多个远程位置。每个位置都有不同的属性:
FTP: host, port, username, password, is_passive
SFTP: host, port, username, password
S3: bucket, key (not sure these are right; I'm guessing)
Dropbox: username, password (again, I'm guessing)
存储这些信息的更有利的数据库表设计是什么?
选项 1(带有每个协议表的主表)
connection
id
name
protocol
ftp_connection
connection_id
host
username
password
port
is_passive
sftp_connection
connection_id
host
username
password
port
s3_connection
connection_id
bucket
key
dropbox_connection
connection_id
username
password
选项 2(带有“属性”表的主表)
connection
id
name
connection_properties
id
connection_id
property_name
property_value
(别担心,我会加密凭据)
【问题讨论】:
标签: ruby-on-rails database-design